import { createRouter, createWebHistory } from 'vue-router';
import { RouteRecordRaw } from 'vue-router'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'layout',
    component: () => import('@/views/Layout/index.vue'),
    children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/views/Home/index.vue')
      },
      {
        path: '/category/:id',
        name: 'category',
        component: () => import('@/views/Category/index.vue')
      },
      {
        path: '/category/sub/:id',
        name: 'subCategory',
        component: () => import('@/views/Category/index.vue')
      },
      {
        path: '/product/:id',
        name: 'product',
        component: () => import('@/views/Category/index.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login/index.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router